package redis

import (
	"context"
	"fmt"
)

const goodsIdStock = "goods:stock_:goods_id_"

func SynGoodsIdStock(stock, goodsId int64) int64 {
	key := goodsIdStock + fmt.Sprintf("%d", goodsId)
	for i := 0; i < int(stock); i++ {

	}
	return Client.LPush(context.Background(), key).Val()
}

func GetGoodsIdStock(goodsId int64) bool {
	key := goodsIdStock + fmt.Sprintf("%d", goodsId)
	return Client.LLen(context.Background(), key).Val() == 1
}
